package com.lenovo.vod.player;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.GridView;

import androidx.appcompat.app.AppCompatActivity;

public class EntryActivity extends AppCompatActivity {
	private Bundle detailMovie;
	private Bundle detailTeleplay;
	private Bundle detailM3u8Stream;

	@Override
	public void onCreate(Bundle icicle) {
		Log.d(Constant.TAG, "EntryActivity onCreate called");

		super.onCreate(icicle);

		setContentView(R.layout.vodplayer_entry);

		detailMovie = new Bundle();
		detailTeleplay = new Bundle();
		detailM3u8Stream = new Bundle();

		setListener();
	}

	public void setListener() {
		Log.d(Constant.TAG, "EntryActivity setListener called");

		String[] movieUri = { "/sdcard/Movies/andylau_concert_trailer_刘德华演唱会_720p.mp4" };
		String[] teleplayUri = {
				"/sdcard/beyonce.3gp",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：奧克拉荷馬大爆炸】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：北海大爆炸】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：德国高铁惊魂】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：夺命恶水】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：惊爆车诺比】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：空难悲歌】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：缆车惊魂记】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：燃烧的渡轮】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：日落特急列车事故】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：隧道炼狱】[NGFANS.COM][中文字幕].mp4",
				"/sdcard/Movies/[国家地理]【重返危机现场：第一季：下水道爆炸事件】[NGFANS.COM][中文字幕].mp4" };

		String[] m3u8StreamUri = {
				"httplive://meta.video.qiyi.com/107/d98a2f7c106486a8a857a04de9303076.m3u8",
				"httplive://61.172.244.8/2/840/500/000/index.m3u8?code=124550&source=BesTV&client=-1&resolution=1",
				"httplive://meta.video.qiyi.com/3/c6c4eb5b894b25029bc704542cbec642.m3u8",
				"httplive://meta.video.qiyi.com/471/f026a1940e4b864934b83f35c0687185.m3u8",
				"httplive://meta.video.qiyi.com/3/c6c4eb5b894b25029bc704542cbec642.m3u8",
				"httplive://meta.video.qiyi.com/471/f026a1940e4b864934b83f35c0687185.m3u8",
				"httplive://meta.video.qiyi.com/3/c6c4eb5b894b25029bc704542cbec642.m3u8",
				"httplive://meta.video.qiyi.com/471/f026a1940e4b864934b83f35c0687185.m3u8",
				"httplive://meta.video.qiyi.com/3/c6c4eb5b894b25029bc704542cbec642.m3u8",
				"httplive://meta.video.qiyi.com/471/f026a1940e4b864934b83f35c0687185.m3u8",
				"httplive://meta.video.qiyi.com/3/c6c4eb5b894b25029bc704542cbec642.m3u8",
				"httplive://meta.video.qiyi.com/471/f026a1940e4b864934b83f35c0687185.m3u8",
				"httplive://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8" };
		// movie
////		GridView gridMovie = (GridView) findViewById(R.id.movie_grid);
////		ArrayList<Integer> movies = new ArrayList<Integer>();
////		for (int num = 1; num <= 1; num++) {
////			Bundle bundle = new Bundle();
////			bundle.putInt("LastExitTime", 300); // 上次退出时间
////			bundle.putString("Url", movieUri[num - 1]); // uri
////
////			detailMovie.putBundle(String.valueOf(num), bundle);
////
////			movies.add(num);
////		}
////		gridMovie.setAdapter(new ArrayAdapter<Integer>(this,
////				android.R.layout.simple_list_item_1, movies));
////
////		gridMovie.setOnItemClickListener(new AdapterView.OnItemClickListener() {
////			@Override
////			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
////					long arg3) {
////				Log.d(Constant.TAG, "EntryActivity onItemClick called [item: "
////						+ arg2 + "]");
////
////				Intent intent = new Intent(EntryActivity.this,
////						VODPlayerActivity.class);
////				intent.putExtra("Name", "刘德华演唱会");// 题目
////				intent.putExtra("PlayEpisode", 0);
////				intent.putExtra("TotalNum", 1);
////				intent.putExtra("DetailMovie", detailMovie);
////				intent.putExtra("Type", 0);
////
////				startActivity(intent);
////			}
////		});
////
////		// teleplay
////		GridView gridTelePlay = (GridView) findViewById(R.id.teleplay_grid);
////		ArrayList<Integer> teleplays = new ArrayList<Integer>();
////		for (int num = 1; num <= 11; num++) {
////			Bundle bundle = new Bundle();
////			bundle.putInt("LastExitTime", 300); // 上次退出时间
////			bundle.putString("Url", teleplayUri[num - 1]); // uri
////
////			detailTeleplay.putBundle(String.valueOf(num), bundle);
////
////			teleplays.add(num);
////		}
////
////		gridTelePlay.setAdapter(new ArrayAdapter<Integer>(this,
////				android.R.layout.simple_list_item_1, teleplays));
////
////		gridTelePlay
////				.setOnItemClickListener(new AdapterView.OnItemClickListener() {
////					@Override
////					public void onItemClick(AdapterView<?> arg0, View arg1,
////							int arg2, long arg3) {
////						Log.d(Constant.TAG,
////								"EntryActivity onItemClick called [item: "
////										+ arg2 + "]");
////
////						Intent intent = new Intent(EntryActivity.this,
////								VODPlayerActivity.class);
////						intent.putExtra("Name", "国家地理");// 题目
////						intent.putExtra("PlayEpisode", arg2 + 1);
////						intent.putExtra("TotalNum", 11);
////						intent.putExtra("DetailMovie", detailTeleplay);
////						intent.putExtra("Type", 1);
////
////						startActivity(intent);
////					}
////				});
//
//		// m3u8 stream
////		GridView gridM3u8Stream = (GridView) findViewById(R.id.m3u8_stream_grid);
////		ArrayList<Integer> m3u8Streams = new ArrayList<Integer>();
////		for (int num = 1; num <= 5; num++) {
////			Bundle bundle = new Bundle();
////
////			bundle.putInt("LastExitTime", 300); // 上次退出时间
////			bundle.putString("Url", m3u8StreamUri[num - 1]); // uri
////
////			detailM3u8Stream.putBundle(String.valueOf(num), bundle);
////
////			m3u8Streams.add(num);
////		}
//		
////		gridM3u8Stream.setAdapter(new ArrayAdapter<Integer>(this,
////				android.R.layout.simple_list_item_1, m3u8Streams));
////
////		gridM3u8Stream
////				.setOnItemClickListener(new AdapterView.OnItemClickListener() {
////					@Override
////					public void onItemClick(AdapterView<?> arg0, View arg1,
////							int arg2, long arg3) {
////						Log.d(Constant.TAG,
////								"EntryActivity onItemClick called [item: "
////										+ arg2 + "]");

						Intent intent = new Intent(EntryActivity.this,
								MainActivity.class);
						
						Bundle bundle = new Bundle();

						PlayerTest.getInstance().getParameter(bundle);
						
						intent.putExtras(bundle);

						startActivity(intent);
//			/
	}
}
